#ifndef NUMERIC_VALUE_H
#define NUMERIC_VALUE_H

#include <glib.h>

typedef struct _NumericValue NumericValue;
typedef struct _NumericValueType NumericValueType;

struct _NumericValue
{
	const NumericValueType* type;
	union {
		gint32 int32Val;
		gint64 int64Val;
		gfloat floatVal;
		gdouble doubleVal;
	};
};

struct _NumericValueType
{
	int (*dispatchOperation)(
		const NumericValue*, const NumericValue*, char, NumericValue*);

	int (*int32Operation)(
		const NumericValue*, char, gint32, NumericValue*);

	int (*doubleOperation)(
		const NumericValue*, char, gdouble, NumericValue*);
};

extern const NumericValueType numericValueType;

inline int NumericValue_dispatchOperation(
	const NumericValue* self, const NumericValue* n, 
	char op, NumericValue* result);

inline int NumericValue_int32Operation(
    const NumericValue* self, char op, gint32 n, NumericValue* result);

inline int NumericValue_doubleOperation(
	const NumericValue* self, char op, gdouble n, NumericValue* result);

#endif /* NUMERIC_VALUE_H */
